package com.lzh.auto;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "token.interceptor")
public class TokenInterceptorProperties {
    private final String[] DEFAULT_PATH_PATTERNS= {"/**"};//默认拦截路径

    private final String[] DEFAULT_EXCLUDE_PATH_PATTERNS = {"/login"};//默认不拦截

    String[] PathPatterns;
    String[] excludePathPatterns;

    public String[] getExcludePathPatterns() {
        if (excludePathPatterns == null){
            return DEFAULT_EXCLUDE_PATH_PATTERNS;
        }
        return excludePathPatterns;
    }

    public void setExcludePathPatterns(String[] excludePathPatterns) {
        this.excludePathPatterns = excludePathPatterns;
    }

    public String[] getPathPatterns() {
        //如果为空返回默认拦截路径
        if (PathPatterns == null){
            return DEFAULT_PATH_PATTERNS;
        }
        return PathPatterns;
    }

    public void setPathPatterns(String[] pathPatterns) {
        PathPatterns = pathPatterns;
    }
}
